<script setup>
import { useRoute } from 'vue-router';
import { orderDetail } from '@/api/order';
import { ref } from 'vue';
const route = useRoute();
const id = route.query.id;
const orderDetailList = ref([]);
const getOrderDetail = async () => {
  const { result } = await orderDetail(id);
  orderDetailList.value = result;
}
getOrderDetail();
</script>
<template>
  <div>
    <el-container>
      <el-header>
        <el-text type="info">
          <h1>订单{{ $route.query.number }}的详情</h1>
        </el-text>
      </el-header>
      <el-main>
        <el-table :data="orderDetailList" style="width: 900px">
          <el-table-column prop="name" label="名称" width="180" />
          <el-table-column label="图片" width="180">
            <template #default="{ row }">
              <el-image style="width: 100px; height: 100px" :src="row.image" />
            </template>
          </el-table-column>
          <el-table-column prop="dishFlavor" label="口味" width="180" />
          <el-table-column prop="number" label="数量" width="180" />
          <el-table-column prop="amount" label="金额" width="180" />
        </el-table>
        <!-- 返回按钮 -->
        <el-button type="primary" @click="$router.go(-1)">返回</el-button>
      </el-main>
    </el-container>
  </div>
</template>
<style scoped>
.el-header {
  background-color: rgb(248, 152, 152);
}

h1 {
  text-align: center;
  height: 100%;
  line-height: 60px;
}

:deep(.el-main) {
  padding-left: calc((100vw - 900px)/2);
}
</style>
